package com.zz.controller;

import com.zz.dto.OccupancyRate;
import com.zz.pojo.Ward;
import com.zz.service.WardService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * Copyright Zz
 * FileName: WardController
 * Author:   Zz
 * Date:     2023/6/1113:26
 * Description:房间表控制层
 * hISTORY:
 * <author>  <time>     <version>    <desc>
 * 作者姓名   修改时间       版本号       描述
 */
@Controller
@RequestMapping("ward")
public class WardController {
    @Autowired
    private WardService wardService;

    /**
     * 得到入住率信息
     * @return 总体入住率以及各个区域的入住率
     */
    @ResponseBody
    @GetMapping("getOuccupancyRate")
    public OccupancyRate getOccupancyRate(){
        return wardService.getOccupancyRate();
    }

    /**
     * 查询指定区域的入住信息
     *
     * @param areaCode 区域号
     * @return 指定区域的入住信息
     */
    @ResponseBody
    @GetMapping("getOuccupancyInfomation")
    public List<Ward> getOccupancyInformation(@RequestParam String areaCode){
        return wardService.getOccupancyInformation(areaCode);
    }
}
